[% setvar title The Perl 6 Summary for the Week Ending 20020922 %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='The Perl 6 Summary for the Week Ending 20020922'></a><h1>The Perl 6 Summary for the Week Ending 20020922</h1>
<p>So, another week, another Perl 6 summary. Let's see if I can get
through this one without calling Tim Bunce 'Tim Bunch' shall we? Or
maybe I should leave a couple of deliberate errors in as a less than
cunning ploy to get more feedback. Hmmm.</p>
<p>So, kicking off with the internals list as always:</p>
<a name='The Compound Key discussions continue'></a><h2>The Compound Key discussions continue</h2>
<p>Dan Sugalski, Graham Barr and Leopold Toetsch (who, incidentally,
turned 44 on the 16th, so not only does he contribute really useful
code, he makes Dan and I feel younger. Can this man do no wrong?)  all
thought hard about Ken Fox's Hard Question from last week. The Hard
Question was: `If <code>%h{&quot;a&quot;}[0][1]</code> is a PASM <code>P2[&quot;a&quot;;0;1]</code>, then what
is <code>%h{&quot;a&quot;}{0}[1]</code>?'. Leo thought that things would work because an
integer isn't a valid key type for a hash, so the second case would throw
a `Not a string' error. Dan thought that this might not be enough, so
we probably need an extra flag to designate whether a key element
should be taken as an array or hash lookup. Graham Barr agreed, citing
the `hash with objects as keys' example that seems to crop up
everywhere, and suggesting the rather lovely looking <code>my @array is
indexed('a'..'b');</code> as another possibility. Graham also wondered how
the flag should be used, suggesting that it should get passed into a
vtable's lookup method, thus allowing the writing of PMCs that don't
care how they're looked up, or other PMCs that did cunning things
depending on how they were accessed. Dan agreed.</p>
<p><a href='http://groups.google.com/groups?threadm=3D85825B.7060004@toetsch.at' target='_blank'>groups.google.com</a></p>
<a name='Return undef for negative indices'></a><h2>Return undef for negative indices</h2>
<p>Sean O'Rourke supplied a patch that arranged for <code>@ary[-1000]</code>, say,
to give <code>undef</code> when <code>@ary</code> has fewer than 1000 elements. Also
included was a patch which changed array's <code>get_string()</code> method to
return the array's <code>get_integer()</code> value converted to a string. Leo
Toetsch wasn't keen on this idea, wondering if it shouldn't return
something like &quot;PerlArray(0xaddr)&quot; by analogy with the behaviour of
PerlHash PMCs. Sean disagreed, pointing out that in Perl5 one could
say <code>print &quot;You scored $score out of&quot; . @questions . &quot;questions.&quot;</code>,
and the array would stringify to the number of elements it
contained. Brent Dax pointed out that in Perl 6 one would have to
write <code>print '\@foo has ' _ +@foo _ ' elements';</code> because Perl 6
arrays stringify to their elements, separated by
<code>.prop{sep} //= ' '</code>. Sean didn't like this, but appeared to take the
point. Uri Guttman quibbled about style, and proposed <code>print &quot;\@foo
has $(@foo.length) elements&quot;;</code>, which certainly does a good job of
making its intention explicit.</p>
<p><a href='http://rt.perl.org/rt2/Ticket/Display.html?id=17346' target='_blank'>rt.perl.org</a></p>
<a name='A Lexicals pre-patch'></a><h2>A Lexicals pre-patch</h2>
<p>Sean O'Rourke was unhappy with the current lexical implementation, as
it doesn't seem to support different levels of static
nesting. Apparently this makes nested scopes hard to implement,
especially in the presence of Perl 6's <code>%MY</code> magic. So he sent a
patch for people to play with.</p>
<p>Jonathan Sillito liked the patch, and pointed to a different
approach that would make taking closures easier, but which would
possibly make lookup slightly less efficient. Sean wondered how Jon's
scheme would handle recursion. Jon thought about that, and answered
by outlining how you would implement closures using Sean's scheme, and
proposing that Sean make a 'real' patch.</p>
<p>J&uuml;rgen <b>ouml</b>mmels had a pile of questions too, related to
using Sean's patch to implement proper Scheme functions, and he
proposed a set of ops for manipulating pads. Sean agreed that this
looked useful.</p>
<p><a href='http://groups.google.com/groups?threadm=Pine.GSO.4.32.0209152038100.73-101000@gradlab.ucsd.edu' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209160934050.32450-100000@taipan.cs.ubc.ca' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209160934050.32450-100000@taipan.cs.ubc.ca' target='_blank'>groups.google.com</a></p>
<a name='default.pmc patches'></a><h2><b><i>default.pmc</i></b> patches</h2>
<p>Leopold Toetsch patched <b><i>default.pmc</i></b> to make almost all methods
throw meaningful exceptions. Sean O'Rourke reckoned that the patch
went a bit far, proposing a few places where having a slightly richer
default behaviour would be the Right Thing to do, and some others
where doing nothing was the right default behaviour -- the example given
was <code>init</code>. Leo countered that one should really have a
<b><i>default_scalar.pmc</i></b> for the first types, and that, for the second
type, the PMC should have an explicitly empty method. The thread
resembled the Monty Python Argument skit for a few messages (`Look,
this isn't a proper argument!', `Yes it is!', `No it isn't it's just
contradiction!'). After a couple of rounds of this, Sean showed his
(substantial) list of default behaviours that he thinks should be in
<b><i>default.pmc</i></b>, and Leo showed us his planned PMC hierarchy.</p>
<p>Dan came down on Leo's side.</p>
<p><a href='http://rt.perl.org/rt2/Ticket/Display.html?id=17358' target='_blank'>rt.perl.org</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.GSO.4.32.0209170711300.27456-100000@gradlab.ucsd.edu' target='_blank'>groups.google.com</a> -- Sean's
list</p>
<p><a href='http://groups.google.com/groups?threadm=3D88134D.20607@toetsch.at' target='_blank'>groups.google.com</a> -- Leo's hierarchy</p>
<a name='Keyed ops'></a><h2>Keyed ops</h2>
<p>Has there been a week since I started doing these summaries that
<i>hasn't</i> seen a discussion of keys, keyed ops or key structures? This
week's <i>second</i> keys thread was kicked off by Leopold Toetsch
wondering about the legality of, for example:</p>
<pre>    add P0[P1], P2, P3[P4]</pre>
<p>If it is legal, what PASM ops should be generated. The problem is
that the naive approach of using an op based on the argument list
would lead to a horrible explosion of specific opcodes to deal with
the possible combinations of keyed and unkeyed arguments. Leo wondered
if the instruction should get turned into:</p>
<pre>    add P0[P1], P2[&lt;The Null Key&gt;], P3[P4]</pre>
<p>Tom Hughes and Leo batted this back and forth for a bit. Tom noted
that it wouldn't be hard to create a null key: just create a key with
0 elements for every PMC that didn't otherwise have a key structure,
but he still worried that we were looking at 64 different op codes for
each 3 argument op.</p>
<p>Sean O'Rourke pointed out that if scratchpads do become `proper'
PMCs, then the various 3 argument keyed ops would become remarkably
useful. For instance <code>@a[0] = %b{1} + $c</code> could become</p>
<pre>    add P0[&quot;@a0&quot;;0], P0[&quot;%b&quot;;1], P0[&quot;$c&quot;]</pre>
<p>But Tom wasn't sure that this quite fit in with Leo's plan. Leo
meanwhile produced an RFC with his proposals for how keyed opcodes
should look.</p>
<p><a href='http://groups.google.com/groups?threadm=3D883BE9.6060600@toetsch.at' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=3D8AE672.7040201@toetsch.at' target='_blank'>groups.google.com</a></p>
<a name='Meanwhile, in perl6-language...'></a><h1>Meanwhile, in perl6-language...</h1>
<p>Last week's discussion of argument passing continued on its merry
way. As well as a certain amount of debate as to the meaning of
`topicalize', Larry clarified a few points. For instance, current
thinking seems to be that if you want to capture the caller's topic
in a named variable you'd do:</p>
<pre>   sub (...) is given ($x) { ... }</pre>
<p>which would set the sub's <code>$x</code> variable to the same value as its caller's
<code>$_</code>. He also offered some comments on good style when using <code>$_</code> and
made Angel Faus's day when he told us that it's looking like parameter
defaults will be specified by <code>=</code> rather than <code>//=</code>. Sean O'Rourke
wasn't entirely sure about the <code>is given</code> syntax, but Larry pointed
out that Sean's proposed syntax wouldn't allow for prototyping
`<code>CORE::print</code>, among other things.' It also looks like we're going
to be using <code>exists</code> to see whether a parameter got passed or not.</p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209200730130.31624-100000@london.wall.org' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209200829370.31624-100000@london.wall.org' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209200858210.31624-100000@london.wall.org' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209200927190.31624-100000@london.wall.org' target='_blank'>groups.google.com</a></p>
<a name='Hotplug regexes, other misc regex questions'></a><h2>Hotplug regexes, other misc regex questions</h2>
<p>Steve Fink asked a few questions, mostly relating to pattern closures
having side effects, supplying a few pathological (psychotic?) patterns
as examples. My particular `favourite' was</p>
<pre>   my $x = &quot;the letter x&quot;;
   print &quot;yes&quot; if $x =~ /the { $x _= &quot;!&quot; } .* !/;</pre>
<p>Damian reckoned that if the above were allowed at all, then the match
should succeed, and offered answers (opinions) on the rest of Steve's
menagerie. One of his suggestions involved a superposition, but I
think he might have been joking. Larry also gave his somewhat more
authoritative answers.</p>
<p><a href='http://groups.google.com/groups?threadm=20020915232729.GM17811@foxglove.digital-integrity.com' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=3D88954F.7010508@conway.org' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209200130560.29479-100000@london.wall.org' target='_blank'>groups.google.com</a></p>
<a name='Hyperoperators and dimensional extension'></a><h2>Hyperoperators and dimensional extension</h2>
<p>Brent Dax wondered about how hyperoperators would work with multiple
dimensions. Dan's answer can be summarized as `properly', which wasn't
quite specific enough for Brent, but Dan stuck to his guns. Dan also
demonstrated that whilst he may be an American, he knows how to spell
`behaviour'.</p>
<p><a href='http://groups.google.com/groups?threadm=007f01c25ee1$a7899760$6501a8c0@deepblue' target='_blank'>groups.google.com</a></p>
<a name='Regex query'></a><h2>Regex query</h2>
<p>Simon Cozens had a few questions about grammars and rules. He's trying
to write a grammar to parse a Linux <b><i>/etc/raidtab</i></b> file, and has a
few questions about `drilling down' into the match object. The thread
is tricky to summarize. However, in one post Larry said that `any
list forced into scalar context will make a ref in Perl 6' and gave
<code>$arrayref = (1,2,3)</code> as an example. This caused a thread explosion,
which has boiled over into the current week as people followed the
implications of that through (some even going so far as to wonder if
that meant we wouldn't need <code>[...]</code> any more). Frankly, things got
ugly (at least syntactically). I'm tempted to draw a veil over some of
the ugliness; if you want to, read the thread. I'm waiting for Larry
to get back home and make everything better with another of his
shockingly wise postings. No pressure Larry.</p>
<p><a href='http://groups.google.com/groups?threadm=86lm5xry63.fsf@squash.oucs.ox.ac.uk' target='_blank'>groups.google.com</a></p>
<p><a href='http://groups.google.com/groups?threadm=Pine.LNX.4.44.0209200110510.29479-100000@london.wall.org' target='_blank'>groups.google.com</a> --
Pigeons, meet a cat.</p>
<a name='Backtracking syntax'></a><h2>Backtracking syntax</h2>
<p>'Ralph' doesn't like the backtracking syntax, and proposed replacing
<code>:</code>, <code>::</code>, <code>:::</code>, <code>&lt;commit&gt;</code> and <code>&lt;cut&gt;</code> with <code>:</code>,
<code>:]</code>, <code>:&gt;</code>, <code>:/</code> and <code>://</code> respectively. Simon Cozens and
Markus Laire spoke up against the proposal.</p>
<p><a href='http://groups.google.com/groups?threadm=039201c26267$684374c0$6601a8c0@ralph' target='_blank'>groups.google.com</a></p>
<a name='In Brief'></a><h1>In Brief</h1>
<p>Leopold Toetsch has sent Dan a patch to implement a proposed hierarchy
of PMC classes. Leo was this week's official patchmonster, submitting
patches to make <b><i>core_ops*.c</i></b> more readable, improve predereferencing
in <b><i>interpreter.c</i></b>, add a test case for restarting the interpreter
and squeezing out a 10% increase in life performance. (This last one
brought some questions from Mike Lambert.)</p>
<p>Simon `Unix Guru' Cozens popped in with some bug spots. First, he
pointed out that the magic number in a .pbc file wasn't being taken
into account in time. Then he found that <code>queens.pasm</code> was solving
the somewhat trivial `one queen problem', rather than the more
impressive `8 queens' problem. Finally, he pointed out that the <b><i>hanoi</i></b>
program seemed to be slightly broken too. And then the week ran out.</p>
<p>Garret Goebbel pointed us all at a survey of native interfaces for
several languages, which can be found at:
<a href='http://xarch.tu-graz.ac.at/autocad/lisp/ffis.html' target='_blank'>xarch.tu-graz.ac.at</a></p>
<a name='Who's Who in Perl 6'></a><h1>Who's Who in Perl 6</h1>
<ul>
<li><a name='Who are you?'></a>Who are you?</li>
<p>Leon Brocard, <a href='mailto:acme@astray.com'>acme@astray.com</a></p>
<li><a name='What do you do for/with Perl 6?'></a>What do you do for/with Perl 6?</li>
<p>I'm currently more interested in the Parrot side of Perl 6. I mostly
tinker with Parrot assembly (PASM), and try to keep the
<a href='http://parrotcode.org/examples/' target='_blank'>parrotcode.org</a> page up to date with current Parrot
thinking. Sometimes I convert C code to PASM by hand. Sometimes I
think evil things about converting other bytecode formats (say, Java's
..class files) to Parrot. I presented a talk at the O'Reilly Open
Source Conference called &quot;Targeting Parrot&quot;
(<a href='http://conferences.oreillynet.com/cs/os2002/view/e_sess/2515),' target='_blank'>conferences.oreillynet.com</a> which
is something that we should make terribly easy to actually do.</p>
<li><a name='Where are you coming from?'></a>Where are you coming from?</li>
<p>680x0 programming, mostly. Programming Parrot is like how you remember
programming assembly was, only higher level and more fun.</p>
<li><a name='When do you think Perl 6 will be released?'></a>When do you think Perl 6 will be released?</li>
<p>Sooner than most people think.</p>
<li><a name='Why are you doing this?'></a>Why are you doing this?</li>
<p>For fun, of course. And because it's interesting to see the development
process behind a fast, portable virtual machine. Actually implementing
Perl 6 on top of Parrot is just a simple matter of programming...</p>
<li><a name='You have 5 words. Describe yourself.'></a>You have 5 words. Describe yourself.</li>
<p>Orange Perl/Parrot Euro-hacker</p>
<li><a name='Do you have anything to declare?'></a>Do you have anything to declare?</li>
<p>I enjoy optimising computer-generated SQL statements.</p>
</ul>
<a name='Acknowledgements'></a><h1>Acknowledgements</h1>
<p>It looks like Wednesday is becoming summary mail out day
now. Surprisingly time consuming so it is...</p>
<p>Thanks to Leon Brocard for answering the questionnaire, making it
embarrassingly easy for me to mention his name this week. I'm now
running <i>really</i> low on sets of answers. Come on people, mail your
answers to mailto:<a href='mailto:5Ws@bofh.org.uk'>5Ws@bofh.org.uk</a> and fame and... well fame anyway
will be yours.</p>
<p>Once more, thanks to the crack proof readers on rhizomatic.net and
elsewhere. This week's primary proof readers were: Kate Pugh, Paul
Makepeace and Simon Bisson. Thanks people.</p>
<p>If you think this summary has value, then please send your money to
the Perl Foundation <a href='http://donate.perl-foundation.org' target='_blank'>donate.perl-foundation.org</a> and help
support the ongoing development of Perl 6. As usual, the fee paid by
the O'Reilly Network for their publication of this summary has been
donated directly to the Perl Foundation.</p>
</div>
